package ar.com.fiuba.ElectronicCircuitAnalyst.domain.api.repository;

import java.util.List;

import ar.com.fiuba.ElectronicCircuitAnalyst.domain.api.Circuit;
import ar.com.fiuba.ElectronicCircuitAnalyst.domain.exceptions.CircuitElementNotFoundException;

/**
 * Interface for a circuit repository. A repository provides a way to retrieve
 * persisted circuits with different criterias.
 * 
 */
public interface CircuitRepository extends Repository<Circuit> {

	/**
	 * Method to retrieve a circuit by name.
	 * 
	 * @param name
	 *            the name of the desired circuit.
	 * @return the circuit with the name.
	 * @throws CircuitElementNotFoundException
	 *             if no circuit with such name is found.
	 */
	public Circuit getCircuitByName(String name) throws CircuitElementNotFoundException;

	public void removeCircuitByName(String name) throws CircuitElementNotFoundException;

	/**
	 * Method to retrieve all circuits that uses directly or indirectly the
	 * circuit element with the name given. For example, if circuit A uses
	 * circuit B and circuit B uses component C, when calling the method with C
	 * this should return both A and B.
	 * 
	 * @param name
	 *            the name of the circuit element used by the returned circuits.
	 * @return circuits related to this circuit element.
	 */
	public List<Circuit> getRelatedCircuits(String name);
}
